import http from '@/utils/http'
const env = import.meta.env
const BASE_URL = env.PROD ? `${env.VITE_API_BASE_URL}/api` : '/api'
const BASE_URL2 = env.PROD ? `${env.VITE_API_BASE_URL4}/admin` : '/fulu'
const BASE_URL8 = env.PROD ? `${env.VITE_API_BASE_URL8}/admin` : '/buyer'
const BASE_URL12 = env.PROD ? `${env.VITE_API_BASE_URL12}/admin` : '/mscb'

/** app设置列表 */
export function adminConfigList() {
  return http.get(`${BASE_URL}/v1/config/adminConfig/list`)
}

/** app设置更改 */
export function adminConfigEdit(data: any) {
  return http.post(`${BASE_URL}/v1/config/adminConfig/update`, data)
}

/** app版本列表 */
export function appVersionConfigList() {
  return http.get(`${BASE_URL}/v1/config/appVersionConfig/list`)
}

/** app版本信息修改 */
export function appVersionConfigEdit(data: any) {
  return http.post(`${BASE_URL}/v1/config/appVersionConfig/update`, data)
}

/** 邀请码导入 */
export function appVersionConfigImport(data: any) {
  return http.post(`${BASE_URL}/v1/config/appVersionConfig/import`, data)
}

/** 转链白名单-列表 */
export function convertUrlWhiteListList(data: any) {
  return http.get(`${BASE_URL}/v1/convertUrlWhiteList/lists`, data)
}

/** 转链白名单-添加 */
export function convertUrlWhiteListAdd(data: any) {
  return http.post(`${BASE_URL}/v1/convertUrlWhiteList/add`, data)
}

/** 转链白名单-删除 */
export function convertUrlWhiteListDelete(data: any) {
  return http.post(`${BASE_URL}/v1/convertUrlWhiteList/delete`, data)
}

/** app错误日志-列表 */
export function appErrorLogList(data: any) {
  return http.get(`${BASE_URL}/v1/appErrorLog/lists`, data)
}

/** app错误日志-导出 */
export function appErrorLogExport(data: any) {
  return http.get(`${BASE_URL}/v1/appErrorLog/export`, data, {}, 'blob')
}

/** APP视频弹窗教程日志统计 */
export function appVideoPopLog(data: any) {
  return http.post(`${BASE_URL}/v1/school/appVideoPopLog`, data)
}

/** @desc 管理员列表 */
export function adminUserList(data: any) {
  return http.get(`${BASE_URL}/admin-user`, data)
}

/** @desc 添加管理员 */
export function adminUserAdd(data: any) {
  return http.post(`${BASE_URL}/admin-user/add`, data)
}

/** @desc 编辑管理员 */
export function adminUserEdit(data: any) {
  return http.put(`${BASE_URL}/admin-user/${data.id}`, data)
}

/** @desc 删除管理员 */
export function adminUserDelete(data: any) {
  return http.delete(`${BASE_URL}/admin-user/${data.id}`)
}

/** @desc 管理员详情 */
export function adminUserDetail(data: any) {
  return http.get(`${BASE_URL}/admin-user/${data.id}`)
}

/** @desc 管理员角色 */
export function adminUserRoles(data: any) {
  return http.get(`${BASE_URL}/admin-user/${data.id}/roles/admin`)
}

/** @desc 管理员添加角色 */
export function adminUserRolesAdd(data: any) {
  return http.put(`${BASE_URL}/admin-user/${data.id}/roles/admin`, data)
}

/** @desc 获取角色列表 */
export function roleList(data: any) {
  return http.get(`${BASE_URL}/role`, data)
}

/** @desc 添加角色 */
export function roleAdd(data: any) {
  return http.post(`${BASE_URL}/role/add`, data)
}

/** @desc 编辑角色 */
export function roleEdit(data: any) {
  return http.put(`${BASE_URL}/role/${data.id}`, data)
}

/** @desc 删除角色 */
export function roleDelete(data: any) {
  return http.delete(`${BASE_URL}/role/${data.id}`)
}

/** @desc 角色详情 */
export function roleDetail(data: any) {
  return http.get(`${BASE_URL}/role/${data.id}`)
}

/** @desc 角色权限 */
export function roleAdmin(data: any) {
  return http.get(`${BASE_URL}/role/${data.id}/permissions`)
}

/** @desc 角色添加权限 */
export function roleAdminAdd(data: any) {
  return http.post(`${BASE_URL}/role/${data.id}/permissions`, data)
}

/** @desc 获取项目下的所有角色 */
export function allRoleList() {
  return http.get(`${BASE_URL}/guard-name-roles/admin`)
}

/** @desc 修改密码 */
export function userChangePassword(data: any) {
  return http.patch(`${BASE_URL}/user-change-password`, data)
}

/** @desc 获取所有权限组 */
export function allPermissionGroupList() {
  return http.get(`${BASE_URL}/permission-group-all`)
}

/** @desc 获取权限组列表 */
export function permissionGroupList(data: any) {
  return http.get(`${BASE_URL}/permission-group`, data)
}

/** @desc 添加权限组 */
export function permissionGroupAdd(data: any) {
  return http.post(`${BASE_URL}/permission-group`, data)
}

/** @desc 编辑权限组 */
export function permissionGroupEdit(data: any) {
  return http.patch(`${BASE_URL}/permission-group/${data.id}`, data)
}

/** @desc 删除权限组 */
export function permissionGroupDelete(data: any) {
  return http.delete(`${BASE_URL}/permission-group/${data.id}`)
}

/** @desc 获取项目下的所有权限 */
export function guardNameForPermissions() {
  return http.get(`${BASE_URL}/guard-name-for-permissions/admin`)
}

/** @desc 当前用户全部权限 */
export function permissionUserAll() {
  return http.get(`${BASE_URL}/permission-user-all`)
}

/** @desc 获取角色全部权限 */
export function currentPermissions(data: any) {
  return http.get(`${BASE_URL}/role/${data.id}/permissions`)
}

/** @desc 权限列表 */
export function permission(data: any) {
  return http.get(`${BASE_URL}/permission`, data)
}

/** @desc 添加权限 */
export function permissionAdd(data: any) {
  return http.post(`${BASE_URL}/permission`, data)
}

/** @desc 编辑权限 */
export function permissionEdit(data: any) {
  return http.patch(`${BASE_URL}/permission/${data.id}`, data)
}

/** @desc 删除权限 */
export function permissionDelete(data: any) {
  return http.delete(`${BASE_URL}/permission/${data.id}`, data)
}

/** @desc 当前用户菜单 */
export function myMenu() {
  return http.get(`${BASE_URL}/my-menu`)
}

/** @desc 菜单列表 */
export function getMenu(data: any) {
  return http.get(`${BASE_URL}/menu`, data)
}

/** @desc 创建菜单 */
export function menuAdd(data: any) {
  return http.post(`${BASE_URL}/menu`, data)
}

/** @desc 编辑菜单 */
export function menuEdit(data: any) {
  return http.patch(`${BASE_URL}/menu/${data.id}`, data)
}

/** @desc 删除菜单 */
export function menuDelete(data: any) {
  return http.delete(`${BASE_URL}/menu/${data.id}`)
}

/** @desc 信通知底部菜单编辑/添加 */
export function wechatMenuAppend(data: any) {
  return http.post(`${BASE_URL2}/wechat/menu/append`, data)
}

/** @desc 微信通知底部菜单列表 */
export function wechatMenuAll(data: any) {
  return http.post(`${BASE_URL2}/wechat/menu/all`, data)
}

/** @desc 微信通知底部菜单删除 */
export function wechatMenuDelete(data: any) {
  return http.post(`${BASE_URL2}/wechat/menu/delete`, data)
}

/** @desc 微信通知底部菜单同步 */
export function wechatMenuSetWechat(data: any) {
  return http.post(`${BASE_URL2}/wechat/menu/setWechat`, data)
}

/** @desc 微信通知素材编辑/添加 */
export function wechatMsgAppend(data: any) {
  return http.post(`${BASE_URL2}/wechat/msg/append`, data)
}

/** @desc 微信通知素材列表 */
export function wechatMsgSearch(data: any) {
  return http.post(`${BASE_URL2}/wechat/msg/search`, data)
}

/** @desc 微信通知素材删除 */
export function wechatMsgDel(data: any) {
  return http.post(`${BASE_URL2}/wechat/msg/del`, data)
}

/** @desc 登录日志 */
export function loginLog(data: any) {
  return http.get(`${BASE_URL}/v1/log/login/list`, data)
}

/** @desc 操作日志 */
export function operationLog(data: any) {
  return http.get(`${BASE_URL}/v1/log/operation/list`, data)
}

/** @desc 应用-列表 */
export function applicationMenuList(data: any) {
  return http.get(`${BASE_URL}/v1/applicationMenu/lists`, data)
}

/** @desc 应用-修改 */
export function applicationMenuAdd(data: any) {
  return http.post(`${BASE_URL}/v1/applicationMenu/add`, data)
}

/** @desc 应用-新增  */
export function applicationMenuEdit(data: any) {
  return http.post(`${BASE_URL}/v1/applicationMenu/update`, data)
}

/** @desc 操作日志 */
export function applicationMenuDelete(data: any) {
  return http.post(`${BASE_URL}/v1/applicationMenu/batchdelete`, data)
}

/** @desc 公告设置 -列表*/
export function announcementList(data: any) {
  return http.post(`${BASE_URL}/v1/announcement/lists`, data)
}

/** @desc 公告设置 -新增 */
export function announcementAdd(data: any) {
  return http.post(`${BASE_URL}/v1/announcement/create`, data)
}

/** @desc 公告设置 -修改 */
export function announcementEdit(data: any) {
  return http.post(`${BASE_URL}/v1/announcement/update`, data)
}

/** @desc 公告设置 -删除 */
export function announcementDelete(data: any) {
  return http.post(`${BASE_URL}/v1/announcement/delete`, data)
}

/** @desc 工具-更新token -列表 */
export function tokenList(data: any) {
  return http.get(`${BASE_URL}/v1/ksToken/lists`, data)
}

/** @desc 工具-更新token -更新 */
export function tokenEdit(data: any) {
  return http.post(`${BASE_URL}/v1/ksToken/update`, data)
}

/** @desc 域名管理 -列表 */
export function domainList(data: any) {
  return http.post(`${BASE_URL8}/buyerCircle/domain/list`, data)
}

/** @desc 域名管理 -新增 */
export function domainAdd(data: any) {
  return http.post(`${BASE_URL8}/buyerCircle/domain/add`, data)
}

/** @desc 域名管理 -编辑 */
export function domainEdit(data: any) {
  return http.post(`${BASE_URL8}/buyerCircle/domain/edit`, data)
}

/** @desc 域名管理 -删除 */
export function domainDelete(data: any) {
  return http.post(`${BASE_URL8}/buyerCircle/domain/del`, data)
}

/** @desc 域名管理 -站点列表*/
export function siteList(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/siteList`, data)
}

/** @desc 域名管理 -同步站点信息*/
export function syncSiteInfo(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/syncSiteInfo`, data)
}

/** @desc 域名管理 -设置站点备注*/
export function setSiteRemark(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/setSiteRemark`, data)
}

/** @desc 域名管理 -平台账户列表*/
export function accountList(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/accountList`, data)
}

/** @desc 域名管理 -平台账户添加/编辑*/
export function accountAppend(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/accountAppend`, data)
}

/** @desc 域名管理 -云厂商列表*/
export function cloudAccountList(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/cloudAccountList`, data)
}

/** @desc 域名管理 -云厂商添加/编辑*/
export function cloudAccountAppend(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/cloudAccountAppend`, data)
}

/** @desc 域名管理 -绑定云厂商*/
export function domainBindCloud(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/domainBindCloud`, data)
}

/** @desc 域名管理 -站点签发证书*/
export function applyCertApi(data: any) {
  return http.post(`${BASE_URL2}/v1/op/ssl/site/applyCertApi`, data)
}

/** @desc 获取搜索配置 */
export function searchConfig(data: any) {
  return http.post(`${BASE_URL12}/v1/appConfig/search/getSearchConfig`, data)
}

/** @desc 修改搜索配置 */
export function editTripartiteConfig(data: any) {
  return http.post(`${BASE_URL12}/v1/appConfig/search/editConfig`, data)
}
